﻿
<div class="modal-header">
    <button type="button" class="close" ng-disabled="loadingState" ng-click="close();"><span aria-hidden="true">&times;</span></button>
    <h3>
        <i class="fa-key"></i>
        修改密码
    </h3>
</div>

<div class="modal-body">
    <form id="changePwdForm" role="form" class="form-horizontal">
        <div class="form-group">
            <label class="col-sm-4 control-label" for="OldPwd">原密码：</label>

            <div class="col-sm-6">
                <input type="password" class="form-control width-fiexd-200 input-inline" id="OldPwd" name="OldPwd" ng-model="oldPwd" placeholder="请输入旧密码" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label" for="NewPwd">新密码：</label>

            <div class="col-sm-6">
                <input type="password" class="form-control width-fiexd-200 input-inline" id="NewPwd" name="NewPwd" ng-model="newPwd" placeholder="请输入新密码" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label" for="ConfirmPwd">确认密码：</label>

            <div class="col-sm-6">
                <input type="password" class="form-control width-fiexd-200 input-inline" id="ConfirmPwd" name="ConfirmPwd" ng-model="confirmPwd" placeholder="请确认新密码" />
            </div>
        </div>
    </form>
</div>

<div class="modal-footer">
    <button type="submit" class="btn btn-turquoise" ng-click="save();" ng-disabled="loadingState">
        <i class="fa fa-save" ng-hide="loadingState"></i>
        <i class="fa fa-spinner fa-spin" ng-show="loadingState"></i>
        <span>保存</span>
    </button>
    <button type="button" class="btn btn-gray" ng-click="close();" ng-disabled="loadingState">
        <i class="fa fa-close"></i>
        <span>关闭</span>
    </button>
</div>

<script>
    $(function () {
        $('form#changePwdForm').validate({
            rules: {
                OldPwd: {
                    required: true,
                    minlength: 5
                },
                NewPwd: {
                    required: true,
                    minlength: 5
                },
                ConfirmPwd: {
                    required: true,
                    minlength: 5,
                    equalTo: '#NewPwd'
                }
            },
            messages: {
                OldPwd: {
                    required: '请输入旧密码！',
                    minlength: '密码最少5个字符！'
                },
                NewPwd: {
                    required: '请输入新密码！',
                    minlength: '密码最少5个字符！'
                },
                ConfirmPwd: {
                    required: '请确认新密码！',
                    minlength: '密码最少5个字符！',
                    equalTo: '两次输入的密码不一致,请检查！'
                }
            }
        });
    });
</script>